{% with messages = get_flashed_messages(with_categories=True) %}
    {% for category,message in messages %}
        {% if message %}
            <div class="am-alert am-alert-{{ category }}" data-am-alert>
                <button type="button" class="am-close">&times;</button>
                <p>{{ message }}</p>
            </div>
        {% endif %}
    {% endfor %}
{% endwith %}